class Queue:
    def __init__(self):
        self.items=[]
    def enqueue(self,item):
        self.items.append(item)
    def dequeue(self):
        return self.items.pop(0)
    def isEmpty(self):
        return self.items==[]
    def size(self):
        return len(self.items)

lt=list(map(int,input().split( )))
oddq=Queue();
evenq=Queue();
inList=[]
for item in lt[1:]:
    if item%2==1:
        oddq.enqueue(item)
    else:
        evenq.enqueue(item)
count=1
while oddq.size()!=0 or evenq.size()!=0:
    if oddq.size()!=0:
        inList.append(oddq.dequeue())

    if evenq.size()!=0:
        if count==2:
            inList.append(evenq.dequeue())
            count = 1
        else:
            count+=1

ltStr=[]
for i in inList:
    ltStr.append(str(i))
print(' '.join(ltStr))
